export function getUrlHost (url) {
  let domain = ''
  url = url.match(/https?:\/\/([^/]+)\//i)
  if (url && url[1]) domain = url[1]
  return domain
}

/**
 * 取URL传参
 * @param name
 * @returns {*}
 */
export const getQueryString = (name) => {
  const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`)
  const str = window.location.search.substr(1).match(reg)
  if (str !== null) {
    return decodeURI(str[2])
  }
  return null
}
